package com.hlkj.pay.app.merchant.ext.impl.yeepay.dto;


/*
 * Hlpay-Plus aggregate payment system.
 * Copyright (c) 2024-2025 Hlpay Team Copyright has the right of final interpretation.
 */

import java.util.ArrayList;
import java.util.List;

import com.hlkj.pay.dto.provider.StepFeeConfig;

import lombok.Data;

/**
 * @author HlpayTeam
 * @date 2025/03/25 16:03
 */
@Data
public class YeePayProductInfo {

    private String productCode;
    private String rateType;
    private String percentRate;
    private String fixedRate;
    private String minRate;
    private List<LadderFee> ladderFeeList;

    @Data
    public static class LadderFee{
        private String ladderMin;
        private String ladderMax;
        private String rateType;
        private String percentRate;
    }


    public static List<LadderFee> formatLadderFeeList(List<StepFeeConfig> stepFeeConfigs){
        List<LadderFee> ladderFees = new ArrayList<>();
        for(StepFeeConfig stepFeeConfig:stepFeeConfigs){
            LadderFee ladderFee = new LadderFee();
            ladderFee.setRateType("SINGLE_FIXED");
            ladderFee.setLadderMin(stepFeeConfig.getStartAmt().toString());
            ladderFee.setLadderMax(stepFeeConfig.getEndAmt().toString());
            ladderFee.setPercentRate(stepFeeConfig.getRateBase().toString());
            ladderFees.add(ladderFee);
        }
        return ladderFees;
    }
}
